<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=1200, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box {
            width: 200px;
            height: 200px;
            border: 1px solid red;
            background-color:gray;
        }
    </style>
</head>
<body>
    <div id="box">box</div>
    <script>
        const oBox = document.querySelector('#box')

        window.addEventListener('click',() => {
            console.log('==> window 捕获阶段')
        },true)
        document.addEventListener('click',() => {
            console.log('==> document 捕获阶段')
        }, true)
        document.documentElement.addEventListener('click',() => {
            console.log('==> html 捕获阶段')
        }, true)
        document.body.addEventListener('click',(event) => {
            console.log('==> body 捕获阶段')
            event.stopPropagation()
        }, true)
        oBox.addEventListener('click',() => {
            console.log('==> box 捕获阶段')
        }, true)

        window.addEventListener('click',() => {
            console.log('==> window 冒泡阶段')
        },false)
        document.addEventListener('click',() => {
            console.log('==> document 冒泡阶段')
        }, false)
        document.documentElement.addEventListener('click',() => {
            console.log('==> html 冒泡阶段')
        }, false)
        document.body.addEventListener('click',() => {
            console.log('==> body 冒泡阶段')
        }, false)
        oBox.addEventListener('click',() => {
            console.log('==> box 冒泡阶段')
        }, false)
    </script>
</body>
</html>